package com.morningstar.system.satoken;

import cn.dev33.satoken.stp.StpUtil;
import com.morningstar.common.dao.config.LogonUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class LogonUserService implements LogonUser {
    @Override
    public Long getLogonUserId() {
        try {
            return StpUtil.getLoginIdAsLong();
        } catch (Exception e) {
            log.warn("getLogonUserId error return System");
            return -999999999L;
        }
    }
}
